jQuery(document).ready(function($){
	
	var clips = new Array();
	
	ZeroClipboard.setMoviePath(wvSettings.url + '/js/ZeroClipboard.swf');

	$('.couponcodes a.coupon-code').each(function(i){

		var clip = new ZeroClipboard.Client();
		
		clip.setHandCursor(true);
		
		clip.setText($(this).html());
		
		if (clip.div) {
			clip.receiveEvent('mouseout', null);
			clip.reposition(this);
		}
		else clip.glue(this);
		clip.receiveEvent('mouseover', null);
		
		clips[i] = clip;
		clip.addEventListener( 'onComplete', copied );
	})
	
	function copied(client, text) {
		var e = $(client.domElement);
		window.open(e.attr('href'));
	}

})